using System.Collections;
using System;
using System.Collections.Generic;
using UnityEngine;

public class ObjectManager : Singleton<ObjectManager>
{
    #region 类对象池的使用

    protected Dictionary<Type, object> ClassPoolDic = new Dictionary<Type, object>();
    
    public ClassObjectPool<T> GetOrCreatClassPool<T>(int maxCount) where T : class, new()
    {
        Type type = typeof(T);
        object outObj = null;
        if (!ClassPoolDic.TryGetValue(type,out outObj) || outObj == null)
        {
            ClassObjectPool<T> newPoll = new ClassObjectPool<T>(maxCount);
            ClassPoolDic.Add(type,newPoll);
            return newPoll;
        }

        return outObj as ClassObjectPool<T>;
    }
    
    #endregion
    
}
